package com.google.code.swingonfire.showcase;

import static com.google.code.swingonfire.builder.JComponentBuilders.*;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;

public class TitlePanel extends JPanel
{

    private static final long serialVersionUID = -1473457519025926651L;

    private final JLabel title;
    private final JTextArea subtitle;

    public TitlePanel(String titleText, String subtitleText)
    {
        super(new BorderLayout());

        setBorder(BorderFactory.createEmptyBorder(8, 12, 8, 12));
        setBackground(Color.WHITE);
        setOpaque(true);

        title = labelBuilder().text(titleText).fontScale(2.0f).fontStyle(Font.BOLD).build();
        subtitle =
            textAreaBuilder().text(subtitleText).wrapStyleWord(true).lineWrap(true).editable(false).font(Font.DIALOG).fontStyle(Font.ITALIC)
                .build();

        add(title, BorderLayout.NORTH);
        add(subtitle, BorderLayout.SOUTH);
    }
}
